<?php

namespace app\common\job;

use app\index\service\ConsultingLawyerMatchV3Service;
use think\facade\Log;
use think\queue\Job;

/**
 * 律师匹配
 * Class ConsultingLawyerMatchV3
 * @package app\common\job
 */
class ConsultingLawyerMatchV3
{
    /**
     * fire是消息队列默认调用的方法
     * @param Job $job 当前的任务对象
     * @param array|mixed $data 发布任务时自定义的数据
     */
    public function fire(Job $job, $data)
    {
        try {

            $this->getConsultingLawyerMatchV3Service()->next($data);

        } catch (\Exception $exception) {
            Log::error('消费队列：' . $exception->getMessage());
        }

        $job->delete();

    }

    private function getConsultingLawyerMatchV3Service(): ConsultingLawyerMatchV3Service
    {
        return app(ConsultingLawyerMatchV3Service::class);
    }

}
